package com.wmyg.antifake.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 王卓逸
 * @program TODO
 * @description TODO
 * @create 2019-05-05
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@Data
@Table(name = "bk_permission")
public class Permission {

    @Id
    @Column(name = "permission_id")
    private Integer permissionId;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "pid")
    @OrderBy(value = "orders asc")
    private List<Permission> permissions = new ArrayList<>();

    @Column(name = "name")
    private String name;

    @Column(name = "type")
    private Integer type;

    @Column(name = "uri")
    private String uri;

    @Column(name = "icon")
    private String icon;

    @Column(name = "status")
    private Integer status;

    @CreatedDate
    @Column(name = "ctime")
    private Date ctime;

    @Column(name = "orders")
    private Integer orders;

}
